# -- coding: utf-8 --

def read_csv(path, symbol):
    """
    读取某个csv格式文件，返回不带注释及空行的内容列表
    :param path: 要读取的csv文件路径
    :param cs: 注释所用的符号，比如#或者//等
    :return: 结果列表
    """
    with open(path, encoding='utf8') as file:
        contents = file.readlines()

    result = []
    for item in contents:
        temp = item.strip()
        if not temp.startswith(symbol) and temp!='':
            if symbol in temp:
                rl = temp.split(symbol)[0].strip()
                result.append(rl)
            else:
                result.append(temp)
    return result

if __name__ == '__main__':

    print(read_csv('../scripts/demo01.csv', '#'))